﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.Build.Utilities;
using Microsoft.Web.Publishing.Tasks;
using Microsoft.Build.Framework;
using System.Xml;
using System.IO;

namespace Deployr
{
    public class DeleteTransformations : Task
    {
        [Required]
        public string ConfigPath
        {
            get;
            set;
        }

        public override bool Execute()
        {
            var configFiles = Directory.GetFiles(this.ConfigPath, "*.config");
            configFiles.Where(file => Path.GetFileName(file.ToLower()) != "web.config").ToList().ForEach(c => File.Delete(c));

            return true;
        }
    }
}